package interfaces;
import java.rmi.*;
import java.util.Collection;

public interface IServer extends Remote
{
	/**
	 * @return the high score
	 * @throws RemoteException
	 */
	public int highScore() throws RemoteException;
	/**
	 * @return the name of the player who got the high score
	 * @throws RemoteException
	 */
	public String highScorePlayer() throws RemoteException;
	/**
	 * @return the scores of the players of the game, in the order in which they registered
	 * @throws RemoteException
	 */
	public int[] scores() throws RemoteException;
	/**
	 * @return the names of the players of the game, in the order in which they registered
	 * @throws RemoteException
	 */
	public String[] names() throws RemoteException;
	/**
	 * @param who - the player who submitted the word
	 * @param word - the word submitted for consideration
	 * @return a negative number if the word submitted was not a word to be guessed, or 
	 *         a non-negative number indicating where in the list of words to be guessed
	 *         this word belongs
	 * @throws RemoteException
	 */
	public int submit(IClient who, String word) throws RemoteException;
	/**
	 * @return how much time is left in the game, in seconds
	 * @throws RemoteException
	 */
	public int timeLeft() throws RemoteException;
	/**
	 * @return an array whose i-th element indicates how many words there are of length
	 *         i to be guessed
	 * @throws RemoteException
	 */
	public int[] numberOfWordsByLength() throws RemoteException;
	/**
	 * @return a java.util.Collection of the Characters from which the player must form words
	 * @throws RemoteException
	 */
	public Collection<Character> letters() throws RemoteException;
	/**
	 * Notify the server that this client invoked the twist functionality
	 * @param who - the player who invoked 'twist'
	 * @throws RemoteException
	 */
	public void twist(IClient who) throws RemoteException;
	/**
	 * @param clientObject - the object on which the server can call update()
	 * @param name - the name of the player being added
	 * @return a non-negative integer indicating which player was registered, or a negative
	 *         number if the game is already started 
	 * @throws RemoteException
	 */
	public int addPlayer(IClient clientObject, String name) throws RemoteException;
}
